package com.dgut.legalservice.service.impl;

import com.dgut.legalservice.dao.IProduct;
import com.dgut.legalservice.domain.Product;
import com.dgut.legalservice.service.ProductService;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ProductServiceImpl implements ProductService {

    @Autowired
    IProduct productDao;

    @Override
    public int addProduct(Product product) {
        int i = productDao.addProduct(product);
        return i;
    }

    @Override
    public int deleteProduct(Integer id) {
        int i = productDao.deleteProduct(id);
        return i;
    }

    @Override
    public int updateProduct(Product product) {
        int i = productDao.updateProduct(product);
        return i;
    }

    @Override
    public List<Product> findProduct() {
        return productDao.findProduct();
    }

    @Override
    public Product findId(Integer id) {
        return productDao.findId(id);
    }

    @Override
    public List<Product> findContract(Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        return productDao.findContract();
    }
}
